<%-------------------------------------------------------------------
 * 页面名称：myAccountList.jsp
 * 功能描述：添加银行账户
 * Action: cn.agiledata.bank.myspace.action.AccountAction
 *
 *-------------------------------------------------------------------
--%>
<%@ page contentType="text/html; charset=utf-8"%>
<%@ taglib uri="/WEB-INF/conf/tld/struts-html.tld" prefix="html"%>
<%@ taglib uri="/WEB-INF/conf/tld/struts-tiles.tld" prefix="tiles"%>
<%@ taglib uri="/WEB-INF/conf/tld/struts-logic.tld" prefix="logic"%>
<%@ taglib uri="/WEB-INF/conf/tld/struts-bean.tld" prefix="bean"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="ipb" uri="/WEB-INF/conf/tld/ipb.tld"%>
<%@ taglib prefix="ad" uri="agiledata"%>
<%@ page import="cn.agiledata.bank.account.service.AccountSummary"%>
<%@ page import="cn.agiledata.bank.account.service.IAccountConst"%>
<%@ page import="cn.agiledata.bank.common.util.Constant"%>
<%@ page import="cn.agiledata.bank.hibernateBean.AccountBank"%>
<%
	String path = request.getContextPath();
	// 取得Session中用户登录信息
	AccountSummary user = (AccountSummary) session
			.getAttribute(Constant.SESSION_ACCOUNT_SUMMARY);
	String realModual = request.getParameter("modual");
	if (realModual == null) {
		String url = request.getRequestURL().toString();
		if (url.indexOf("first") > 0) {//历史交易查询
			realModual = "first";
		} else {
			realModual = "null";
		}

	}
%>
<div id="main">
	<div class="content_right">
		<div style="width:745px;margin-left:10px;">
			<div class="titleinfo">
				我的银行账户 
			</div>
			<div class="edit_pass">
				<table width="100%" class="tablestyle">
					<tr>
						<%--<th>
							<span class="blue14">默认</span>
						</th>
						--%><th>
							<span class="blue14">银行卡名称</span>
						</th>
						<th>
							<span class="blue14">银行卡号</span>
						</th>
						<th>
							<span class="blue14">开户行城市</span>
						</th>
						<th>
							<span class="blue14">编辑</span>
						</th>
					</tr>
					<%
					int aBankIndex = 0;
					%>
					<%
					String defaultId = "";
					%>
					<logic:iterate name="aBankList" id="aBank" indexId="i">
						<bean:define id="aBankObj" name="aBank" />
						<%
								AccountBank ab = (AccountBank) aBankObj;
								if (ab.getDefaultFlag().equals("Y")) {
									defaultId = String.valueOf(ab.getId());
								}
						%>
						<tr
							class="<%=i.intValue() % 2 == 0 ? "tableWhiteBg"
								: "tableBlueBg"%>">
							<%--<td height="28" align="center">
								<input
									onclick="javascript:confirmModify('<bean:write name="displayBean" property="msg1"/>','<bean:write name="aBank" property="id"/>');"
									type="radio" style="border:0"
									<logic:equal value="Y" name="aBank" property="defaultFlag">checked</logic:equal>
							</td>
							--%><td align="center">
								<bean:write name="aBank" property="bankAlias" />
							</td>
							<td align="center">
								<bean:write name="aBank" property="accountId" />
							</td>
							<td align="center">
								<ad:write typeid="CITY_INFO" name="aBank" property="citySeq" />
							</td>
							<td align="center">
								<a
									href="<%=path%>/page/myspace/accountDetail.do?aBankID=<bean:write name="aBank" property="id"/>"><img
										alt="编辑" src="<%=path%>/images/edit_icon.gif" width="16"
										height="16" border="0" /> </a>
							</td>
						</tr>
						<%
						aBankIndex++;
						%>
					</logic:iterate>
				</table>
				<div class="button_Frame">
					<%
								if (user != null
								&& IAccountConst.USERTYPE_CORP_ADMIN.equals(user
								.getUserType())) {
					%>
					<input type="button" class="button_style_m" name="Submit"
						value="<bean:write name="displayBean" property="buttonName" />"
						onclick="location.href='accountDetail.do'" />
					<logic:equal name="contextType" value="mySpace">
						<input type="button" class="button_style" name="back" value="返 回"
							onclick="location='<%=path%>/route.do?modual=space$account';" />
					</logic:equal>
					<logic:notEqual name="contextType" value="mySpace">
						<input type="button" class="button_style" name="back" value="返 回"
							onclick="location='<%=path%>/route.do?modual=space$account';" />
					</logic:notEqual>
					<%
					} else {
					%>

					<%
					if (realModual.equals("first")) {
					%>
					<input type="button" class="button_style_m" name="Submit"
						value="<bean:write name="displayBean" property="buttonName" />"
						onclick="location.href='accountDetail.do'" />
					<logic:equal name="contextType" value="mySpace">
						<input type="button" class="button_style" name="back" value="返 回"
							onclick="location='<%=path%>/route.do?modual=space$account';" />
					</logic:equal>
					<logic:notEqual name="contextType" value="mySpace">
						<input type="button" class="button_style" name="back" value="返 回"
							onclick="location='<%=path%>/route.do?modual=space$account';" />
					</logic:notEqual>
					<%
					} else {
					%>
					<%--<input type="button" class="button_style_m" name="Submit"
						value="<bean:write name="displayBean" property="buttonName" />"
						onclick="location.href='accountDetail.do'" />
					--%><logic:equal name="contextType" value="mySpace">
						<input type="button" class="button_style" name="back" value="返 回"
							onclick="location.href='accountInfo.do?showTab=3'" />
					</logic:equal>
					<logic:notEqual name="contextType" value="mySpace">
						<input type="button" class="button_style" name="back" value="返 回"
							onclick="location='<%=path%>/route.do?modual=space$account';" />
					</logic:notEqual>

					<%
						}
						}
					%>

				</div>
			</div>
		</div>
	</div>
</div>
<script language="javascript">
	var aBankIndex = '<%=aBankIndex%>';
	var defalutId = '<%=defaultId%>';
	function confirmModify(msg, aBankId) {
		if (aBankIndex=='1') {
			//only one card, do nothing.
		} else if (aBankId==defalutId) {
			//already is default card, do nothing.
		} else if (confirm(msg)) {
			location.href='accountSetDefault.do?aBankID='+aBankId;
		}
	}
</script>
